/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-26
 * Time: 15:35
 */
import java.util.Scanner;
public class Main{
    public static void main(String args[]) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        Shape sp[]=new Shape[n];
        String name;
        for(int i=0;i<n;i++) {
            name=scan.next();
            if(name.equalsIgnoreCase("rect"))
                sp[i]=new Rectangle(scan.nextInt(),scan.nextInt());
            if(name.equalsIgnoreCase("cir"))
                sp[i]=new Circle(scan.nextDouble());
            System.out.println(sp[i]);
        }
        System.out.println("总面积为："+Sum.sumAllArea(sp));
        System.out.println("总周长为："+Sum.sumAllPerimeter(sp));
    }
}

/* 请在这里填写答案 */
abstract class Shape{
    public static double PI = 3.14;
    public abstract double getPerimeter();
    public abstract double getArea();
}
class Rectangle extends Shape{
    private int width;
    private int length;
    @Override
    public double getPerimeter() {
        return 2.0*(width+length);
    }

    @Override
    public double getArea() {
        return width*length;
    }
    Rectangle(int width,int length){
        this.length=length;
        this.width=width;
    }

    @Override
    public String toString() {
        return "Rectangle [width="+width+", length="+length+", area="
        +getArea()+", perimeter="+getPerimeter()+"]";
    }
}
class Circle extends Shape{
    private double radius;
    @Override
    public double getPerimeter() {
        return 2.0*radius*super.PI;
    }

    @Override
    public double getArea() {
        return radius*radius*super.PI;
    }
    Circle(double radius){
        this.radius=radius;
    }

    @Override
    public String toString() {
        return "Circle [radius="+radius+
        ", area="+getArea()+", perimeter="+getPerimeter()+"]";
    }
}
class Sum{
    static double sumAllArea(Shape s[]) {
        double sum = 0;
        for (int i = 0; i < s.length; i++) {
            sum += s[i].getArea();
        }
        return sum;
    }
    static double sumAllPerimeter(Shape s[]) {
        double sum = 0;
        for (int i = 0; i < s.length; i++) {
            sum += s[i].getPerimeter();
        }
        return sum;
    }
}